package cn.ittest.service.impl;
/*
* 业务层实现类
* */

import cn.ittest.dao.StudentDao;
import cn.ittest.dao.impl.StudentDaoImpl;
import cn.ittest.domain.Student;
import cn.ittest.service.StudentService;

import java.util.ArrayList;

public class StudentServiceImpl implements StudentService {
    private StudentDao dao = new StudentDaoImpl();
    //查询所有操作
    @Override
    public ArrayList<Student> findAll() {
        ArrayList<Student> list = dao.findAll();
        return list;
    }
    //有条件查询
    @Override
    public Student findById(Integer id) {
        Student stu = dao.findById(id);
        return stu;
    }
    //新增数据
    @Override
    public int insert(Student stu) {
        int count = dao.insert(stu);
        return count;
    }
    //删除数据
    @Override
    public int delete(Student stu) {
        int i = dao.delete(stu);
        return i;
    }
    //修改数据
    @Override
    public int update(Student stu) {
        int update = dao.update(stu);
        return update;
    }
}
